﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Alos.Common;
using Alos.Entity;
using Alos.IService;
using Newtonsoft.Json;
using System.Threading.Tasks;

namespace Alos.LanClass.Api
{
    /// <summary>
    /// 资源评价记录表(学生看资源时：对资源点赞，不懂)
    /// </summary>
    public class ReResourceEvaluateRecordController : ApiController
    {
       IReResourceEvaluateRecordService ReResourceEvaluateRecordService;
        /// <summary>
        /// 构造函数
        /// </summary>
       /// <param name="_ReResourceEvaluateRecordService"></param>
       public ReResourceEvaluateRecordController(IReResourceEvaluateRecordService _ReResourceEvaluateRecordService)
        {
            ReResourceEvaluateRecordService = _ReResourceEvaluateRecordService;         
        }
       /// <summary>
       /// 添加资源评价记录表
       /// <param name="data">资源评价记录</param>
       /// </summary>
       [HttpPost]
       [Route("api/ReResourceEvaluateRecord/CreateReResourceEvaluateRecord")]
       public JsonRtn<dynamic> CreateReResourceEvaluateRecord([FromBody]dynamic data)
       {
           List<ReResourceEvaluateRecord> ReResourceEvaluateRecords = JsonConvert.DeserializeObject<List<ReResourceEvaluateRecord>>(data);
           var jsRtn = new JsonRtn<dynamic>();
           jsRtn.message = ReResourceEvaluateRecordService.CreateReResourceEvaluateRecord(ReResourceEvaluateRecords) ? "true" : "false";
           return jsRtn;
       }
    }
}
